#ifndef RISING_STAR_COMMON_H
#define RISING_STAR_COMMON_H
#include <string>
#include <map>
#include <list>

#include <boost/xpressive/xpressive_dynamic.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/optional.hpp>
#include <boost/filesystem.hpp>

using namespace std;
using namespace boost::xpressive;
using namespace boost::filesystem;
typedef recursive_directory_iterator rd_iterator;

namespace RisingStar
{
	class Common
	{
		public:
			Common();
			~Common();
		static int LOG(const char* fun, int line,string event,string logFile = "",string label="");
		static bool FindFiles(const path& dir, const string& fileName,vector<path>& v);
		static string FixString(string in,int width,char fix='0');
		static string FixString(int in,int width,char fix='0');
		static string GetLocalTime();
		static bool ExtractVariableFromFormula(string& formula,string& val);
		static string ReplaceString(string str,string oldKeyStr,string newKeyStr);
	};
	
}
#define _EVENT(event) RisingStar::Common::LOG(__FUNCTION__,__LINE__,event,"",GSTR("事件"))
#define _WARNNING(event) RisingStar::Common::LOG(__FUNCTION__,__LINE__,event,"",YSTR("警告"))
#define _ERROR(event) RisingStar::Common::LOG(__FUNCTION__,__LINE__,event,"",RSTR("错误"))

#endif
